load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "ppsdb",
    srcs = [
        "pipelines.go",
        "ppsdb.go",
        "ppsdb.pb.go",
        "ppsdb.pb.validate.go",
        "ppsdb.pb.zap.go",
    ],
    importpath = "github.com/pachyderm/pachyderm/v2/src/internal/ppsdb",
    visibility = ["//src:__subpackages__"],
    deps = [
        "//src/internal/collection",
        "//src/internal/errors",
        "//src/internal/pachsql",
        "//src/internal/pfsdb",
        "//src/internal/uuid",
        "//src/pfs",
        "//src/pps",
        "//src/protoextensions",
        "@com_github_jmoiron_sqlx//:sqlx",
        "@org_golang_google_protobuf//proto",
        "@org_golang_google_protobuf//reflect/protoreflect",
        "@org_golang_google_protobuf//runtime/protoimpl",
        "@org_golang_google_protobuf//types/known/anypb",
        "@org_golang_google_protobuf//types/known/timestamppb",
        "@org_uber_go_zap//zapcore",
    ],
)

go_test(
    name = "ppsdb_test",
    size = "small",
    srcs = [
        "pipelines_test.go",
        "ppsdb_test.go",
    ],
    embed = [":ppsdb"],
    deps = [
        "//src/internal/clusterstate",
        "//src/internal/dockertestenv",
        "//src/internal/migrations",
        "//src/internal/pachsql",
        "//src/internal/pctx",
        "//src/internal/pfsdb",
        "//src/internal/protoutil",
        "//src/internal/require",
        "//src/internal/testetcd",
        "//src/internal/uuid",
        "//src/pfs",
        "//src/pps",
        "@com_github_google_go_cmp//cmp",
        "@org_golang_google_protobuf//testing/protocmp",
        "@org_golang_google_protobuf//types/known/timestamppb",
    ],
)

filegroup(
    name = "protos",
    srcs = glob(["*.proto"]),
    visibility = ["//src:__pkg__"],
)
